package com.eportal.action;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;



public class UServlet extends HttpServlet{

	private Logger log = Logger.getLogger(UServlet.class);
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		//String methodName = null;
		String uri = req.getRequestURI();
		String methodName = uri.substring(uri.lastIndexOf("/")+1);
		try {
			Method[] m= this.getClass().getMethods();
			Method method =  this.getClass().getMethod(methodName, new Class[]{HttpServletRequest.class, HttpServletResponse.class});
			method.invoke(this, new Object[]{req,resp});
		} catch (Exception e) {
			log.error(this, e);
		} 
		
	}
	
	/**
	 * 下载app地址
	 * @param req
	 * @param resp
	 */
	public void b(HttpServletRequest req, HttpServletResponse resp) {
		try {
			req.getRequestDispatcher("/admin/appstore_downloadAppView.action").forward(req, resp);
		} catch (Exception e) {
			log.error(this, e);
		}
		return;
	}
	
	
	/**
	 * 锁厂扫码登录
	 * @param req
	 * @param resp
	 */
	public void c(HttpServletRequest req, HttpServletResponse resp) {
		try {
			req.getRequestDispatcher("/admin/lbq.action").forward(req, resp);
		} catch (Exception e) {
			log.error(this, e);
		}
		return;
	}
	
	/**
	 * 二维码付款
	 * @param req
	 * @param resp
	 */
	public void d(HttpServletRequest req, HttpServletResponse resp) {
		try {
			req.getRequestDispatcher("/admin/payQrcode_payView.action").forward(req, resp);
		} catch (Exception e) {
			log.error(this, e);
		}
		return;
	}
}
